package com.guide.enums;


import java.util.HashMap;
import java.util.Map;

public enum ErrorCodeEnum {
	//新的返回�?
    SYSTEM_ERROR(10001, "System error", "系统错误"), //
    SYSTEM_PARAMS_ERROR(10002, "Param error, see doc for more info", "参数错误，请参�?API文档"),
    SYSTEM_BAD_JSON_FORMART(10003, "Bad json format", "错误的json格式"),
    SYSTEM_UNSUPPORT_PROTOCAL(1004, "Unsupport protocal", "不支持的协议"),
    SYSTEM_DB_ERROR(10005, "DataBase Error", "数据库操作发生错?"),
    
    //
    CODE_GUIDE_NO_LOGIN_ERROR(600000, "no login", "请登录"),
    CODE_GUIDE_USERNMAE_EXIST_ERROR(600001, "username exist error", "用户名已存在"),
    CODE_GUIDE_USERNMAE_NOTEXIST_ERROR(600002, "username not  exist error", "用户名不存在"),
    CODE_GUIDE_PASS_ERROR(600003, "password  error", "密码错误"),
    CODE_GUIDE_REGISTER_NO_APPLY_ERROR(600003, "register no apply error", "注册未审核"),
    CODE_GUIDE_TEAM_APPLYED_ERROR(600004, "team applyed error", "已申请该团"),
    CODE_GUIDE_TEAM_ERROR(600005, "team error", "该团不接受申请，请选择其他团"),
    CODE_GUIDE_REMOVE_TEAM_ERROR(600006, "remove team error", "该团已有导游申请，不能删除"),
    CODE_COMMENTS_OPT_ERROR(600007, "comments error", "已评价"),
    CODE_GUIDE_TRAVELORG_EXIST_ERROR(600008, "travelorg exist error", "旅行社重复注册，请认真填写，要做认证使用"),
    CODE_GUIDE_PERSONAL_EXIST_ERROR(600009, "personal exist error", "身份证信息重复，请认真填写，要做认证使用"),
    CODE_GUIDE_GUIDE_EXIST_ERROR(600010, "guide exist error", "身份证信息重复，请认真填写，要做认证使用"),
    CODE_GUIDE_SMS_PARAM_ERROR(600011, "sms param error", "短信参数错误"),
//    SYSTEM_INNERAUTH_ERROR(10031, "innerAuth error", "内部权限校验发生错误"),
    
    CODE_TP_SMS_INTERFACE_ERROR(600012, "commit interface error", "提交接口错误"),
    CODE_TP_SMS_AUTH_ERROR(600013, "auth error", "用户名或密码错误"),
    CODE_TP_SMS_TEMPLATE_ERROR(600014, "template error", "短信内容与模板不一致"),
    CODE_TP_SMS_SIGN_ERROR(600015, "sign Error", "签名错误"),
    CODE_TP_SMS_BALANCE_ERROR(600016, "balance not enough", "余额不足"),
    CODE_TP_SMS_CHANNEL_ERROR(600017, "channel error", "通道错误"),
    CODE_TP_SMS_INVALID_NUM_ERROR(600018, "invalid num error", "无效号码"),
    CODE_TP_SMS_INVALID_CHANNEL(600019, "invalid channel error", "无效的短信通道"),
    
    
    null_error(0, "", "");
    /** 错误码*/
    private final int errorCode;

    /** 错误名称外部 */
    private final String error;

    /** 错误描述内部 */
    private final String errorText;

    ErrorCodeEnum(int errorCode, String error, String errorText) {
        this.errorCode = errorCode;
        this.error = error;
        this.errorText = errorText;
    }

    private static Map<Integer, ErrorCodeEnum> errorCodeEnumMap = new HashMap<Integer, ErrorCodeEnum>();

    static {
        for (ErrorCodeEnum errorCodeEnum : ErrorCodeEnum.values()) {
            errorCodeEnumMap.put(errorCodeEnum.errorCode, errorCodeEnum);
        }
    }

    public static ErrorCodeEnum getErrorCodeEnumFromId(int code) {
        return errorCodeEnumMap.get(code);
    }

    
    
    public int getErrorCode() {
		return errorCode;
	}



	public String getError() {
		return error;
	}



	public String getErrorText() {
		return errorText;
	}



	@Override
    public String toString() {
        return "errorCode:" + this.errorCode + ",error:" + error + ",errorText:" + errorText;
    }
}
